package com.slz3.business.module.systemManagement.sysRole.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.systemManagement.sysRole.domain.SysRole;
import com.slz3.business.module.systemManagement.sysRole.domain.SysRoleFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class SysRoleTransactionalServiceImpl implements SysRoleTransactionalService {

    @Override
    public SysRole modify(SysRole sysRoleNew) {
        Repositorys.sysRole.test();
        Repositorys.sysRole.save(SysRoleFactory.initBaseFields());
        System.err.println(1/0);
        sysRoleNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.sysRole.saveAndFlush(sysRoleNew);
    }

    @Override
    public List<SysRole> batchModify(List<SysRole> sysRoleList) {
        return Repositorys.sysRole.saveAll(sysRoleList);
    }
}
